#!/bin/bash

kill_pid=`ps -ef | grep "run_robot"  |grep -v grep | awk '{print $2}'`

# 判断进程是否存在，如果存在，则不在再重复执行
if [ -n "${kill_pid}" ]
then
    echo "pid = ${kill_pid} 程序正在运行中，请勿重复启动"
    exit 1
else
    YHS_MIDWARE="/home/yhs/.wrks/hkprinter/HKPrinter"
    YHS_MIDWARE_LIB=${YHS_MIDWARE}/devel/lib
    YHS_MIDWARE_BIN=${YHS_MIDWARE}/devel/lib/ros_midware
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$YHS_MIDWARE_LIB
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$YHS_MIDWARE_BIN
    source ${YHS_MIDWARE}/devel/setup.bash --extend
    ${YHS_MIDWARE_BIN}/run_robot ${YHS_MIDWARE}/config/config.yaml
fi